﻿<%@ Page Language="C#"  Title="预养措施复选"  MasterPageFile="~/W_View/PageMaster.Master" CodeBehind="PrevemeassecPage.aspx.cs" Inherits="STHPMS1.Web.W_View.Decision.Preventive.PrevemeassecPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/datagrid.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/dropdown.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/Jquery/ajaxfileupload.js")%>

    <script type="text/javascript">

        function B_RoadwayEdit(flag) {
            var row = $('#dg').datagrid('getSelected');
            var title = "";
            if (flag == 0) {
                if (!row) {
                    $.messager.alert('消息提示', '编辑数据时，请选择一项!', 'warning');
                    return;
                }
                $('#fm').form('load', row);
                title = "新增测试数据";
            }
            else {
                $('#fm').form('clear');
                title = "编辑测试数据";
            }

            $('#dlg').dialog('open');
        }

        //计算等效年度费用
        function SetEAC()
        {
            var anniname = $('#cmbAnniName').combobox("getValue");
            var analy_year = $('#cmbAnaly_Year').combobox("getValue");
            if (!anniname && !analy_year) {
                $.messager.alert('消息提示', '请选择资金模型名称和分析年度！', 'warning');
                return;
            }

            $.ajax({
                url: "/api/prevendetail/seteac?anniname=" + anniname + "&analy_year=" + analy_year + "",
                type: "GET",
                success: function () {
                    $.messager.alert('成功', '计算等效年度费用!', "info");
                    $('#dg').datagrid({ url: '/api/prevendetail', pageNumber: 1 });
                },
                error: function (err) {
                    $.messager.alert('错误提示', '计算等效年度费用失败 -' + err, "error");
                }
            });
        }

        //自动选取复选措施
        function SetFX()
        {
            var anniname = $('#cmbAnniName').combobox("getValue");
            var analy_year = $('#cmbAnaly_Year').combobox("getValue");
            if (!anniname && !analy_year) {
                $.messager.alert('消息提示', '请选择资金模型名称和分析年度！', 'warning');
                return;
            }

            $.ajax({
                url: "/api/prevendetail/setseconmeasure?anniname=" + anniname + "&analy_year=" + analy_year + "",
                type: "GET",
                success: function () {
                    $.messager.alert('成功', '自动选取复选措施!', "info");
                    $('#dg').datagrid({ url: '/api/prevendetail', pageNumber: 1 });
                },
                error: function (err) {
                    $.messager.alert('错误提示', '自动选取复选措施失败 -' + err, "error");
                }
            });
        }


       

        function search(n, o) {
            var anniname = $('#cmbAnniName').combobox("getValue");
            var analy_year = $('#cmbAnaly_Year').combobox("getValue");

            var url = '/api/prevendetail';
            var urlParam = "";
            if (anniname != "" && anniname != "0") urlParam += "anniname=" + encodeURI(anniname) + "&";
            if (analy_year != "" && analy_year != "0") urlParam += "analy_year=" + encodeURI(analy_year) + "&";
            if (urlParam != "") {
                urlParam = "?" + urlParam.substring(0, urlParam.length - 1);
                url = url + urlParam;
            }

            $('#dg').datagrid({ url: url, pageNumber: 1 });
        }


        $(function () {
            var number = '<%= Page.RouteData.Values["page"] %>';
            var size = '<%= Page.RouteData.Values["size"] %>';

            loadAdmDiv();
            dataGridBind($('#dg'), '/api/prevendetail', '预养措施复选', $('#tb'), number, size);

            $('.validatebox-text').bind('blur', function () {
                $(this).validatebox('enableValidation').validatebox('validate');
            });
        })
       

    </script>    

    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table id="dg" class="easyui-datagrid content-place"  ajaxCached="false"  >
        <thead>
            <th data-options="field:'Id',editor:'text',width:80,align:'right',hidden:true">ID</th>
            <th data-options="field:'Analy_Year',editor:'text',width:100,align:'right' ">分析年度</th>
            <th data-options="field:'Rdwayid',editor:'text',width:80,align:'right' ">路线编号</th>
            <th data-options="field:'Mainsegid',editor:'text',width:300,align:'right' ">养护路段</th>
            <th data-options="field:'Rd_Class',editor:'text',width:150,align:'right' " formatter="formatRoadClass">公路等级</th>
            <th data-options="field:'Meas_Ini',editor:'numberbox',width:150,align:'right' ">初选措施</th>
            <th data-options="field:'Servi_Life',editor:'numberbox',width:80,align:'right' " >使用寿命/年</th>
            <th data-options="field:'Unit_Cost',editor:'text',width:150,align:'right' " >单位成本（元/m2） </th>
            <th data-options="field:'Eac',editor:'text',width:80,align:'right' " formatter="formatNumber" >等效年度费用</th>
            <th data-options="field:'Cost',editor:'text',width:80,align:'right' " formatter="formatNumber" >总费用/万元</th>

            <th data-options="field:'Secon_Measure',editor:'text',width:160,align:'right' " formatter="formatYesNoType">复选措施</th>
            

        </thead>
    </table>
   
    <div id="tb">
        <%-- <select id="cmbRoads" class="easyui-combobox" panelHeight="80" style="width:100px" data-options="prompt:'路线编号',url:'/api/roadway/dict',method:'get',valueField:'id',textField:'id',onChange:search">
         </select>--%>

       <%-- <select id="cmbRoadnetId" class="easyui-combobox" panelHeight="80" style="width:100px" data-options="prompt:'路网名称',url:'/api/roadnet/getroadnet',method:'get',valueField:'id',textField:'text'">
         </select>--%>

         <select id="cmbAnniName" class="easyui-combobox" panelHeight="80" style="width:100px" data-options="prompt:'资金模型名称',url:'/api/dfcostmodpara/anniname',method:'get',valueField:'id',textField:'id'">
         </select>

        <select id="cmbAnaly_Year" class="easyui-combobox" name="cmbAnaly_Year" data-options="prompt:'分析年度',onChange:search" style="width:100px;">   
            <option value="2015">2015年</option>   
            <option value="2016">2016年</option>   
            <option value="2017">2017年</option>   
            <option value="2018">2018年</option>   
            <option value="2019">2019年</option>   
        </select>  
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="B_RoadwayEdit(0)">编辑</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" onclick="SetEAC()">计算等效年度费用</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" onclick="SetFX()">自动选取复选措施</a>
        <a href="/dp_projrecom" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" >下一步终选</a>
        
     
    </div>


    <div id="dlg" class="easyui-dialog" title="保存数据" style="width:500px;height:300px;padding:10px" closed="true"  data-options="
				iconCls: 'icon-save',
				buttons: '#dlg-buttons'">
        <form id="fm" method="post" action="/api/prevendetail">
            <table>		
                 <tr style="display:none">
                    <td>ID:</td>
                    <td><input name='Id' class='easyui-validatebox easyui-textbox'  /></td>
                </tr>	     
                <tr>
                    <td>路线编号:</td>
                    <td><input name='Rdwayid' class='easyui-validatebox  easyui-textbox'  data-options="readonly:true"/></td>
                </tr>
                <tr>
                    <td>养护路段:</td>
                    <td><input name='Mainsegid' class='easyui-validatebox easyui-textbox'  data-options="readonly:true"/></td>
                </tr>

                 <tr>
                    <td>技术等级:</td>
                    <td><input id="Rd_Class" name='Rd_Class'  class="easyui-combobox" data-options="readonly:true,prompt:'技术等级',valueField:'id',textField:'text',url:'/api/data/roadclass',method:'get',panelHeight:'auto'"/></td>
                </tr>
                <tr>
                    <td>初选措施:</td>
                    <td><input name='Meas_Ini' class='easyui-validatebox easyui-textbox' data-options="readonly:true" /></td>
                </tr>
                <tr>
                    <td>使用寿命/年:</td>
                    <td><input name='Servi_Life' class='easyui-validatebox easyui-numberbox' data-options="required:true,min:0,precision:2"/></td>
                </tr>
                <tr>
                    <td>单位成本（元/m2）:</td>                    
	                <td><input name='Unit_Cost'  class="easyui-validatebox easyui-numberbox" data-options="required:true,min:0,precision:2"  />
                </tr>
		    </table>
        </form>
    </div>

     <div id="dlg-buttons">
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="sumbitData($('#dg'),$('#dlg'))">保存</a>

         <%--<a href="javascript:void(0)" class="easyui-linkbutton" onclick="Save()">保存</a>--%>
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:$('#dlg').dialog('close')">取消</a>
	</div>

    

    
</asp:Content>

